const path = require('path')
function resolve(dir) {
  return path.join(__dirname, './src/', dir)
}
module.exports = {
  pages: {
    main: { // 移动端
      entry: 'src/main.js',
      template: 'public/mobile.html',
      filename: 'index.html',
      title: 'Index Page'
    },
    mobileStyle: { // 移动端
      entry: 'src/pages/mobile-style/main.js',
      template: 'public/mobile.html', // 移动端的模板
      filename: 'mobile-style.html',
      title: '移动端样式集合'
    },
    openlayer: { // PC端综合项目
      entry: 'src/pages/desktop/main.js',
      template: 'public/desktop.html',
      filename: 'desktop.html',
      title: 'PC端综合案例集合'
    }
    // desktop: { // PC端
    //   entry: 'src/pages/desktop/main.js',
    //   template: 'public/desktop.html', // 'public/desktop.html',
    //   filename: 'desktop.html',
    //   title: 'desktop'
    // }
  },
  css: {
    loaderOptions: {
      stylus: {
        'resolve url': true,
        'import': [
          './src/styles/theme'
        ]
      }
    }
  },
  pluginOptions: {
    'cube-ui': {
      postCompile: true,
      theme: true
    }
  },
  devServer: {
    port: 8080, // 端口号
    host: 'localhost', // '192.168.10.115',
    https: false, // https:{type:Boolean}
    open: true, // 配置自动启动浏览器
    proxy: {
      '/api': {
        target: 'https://api.dongqiudi.com/app/',
        changeOrigin: true,
        pathRewrite: {
          '^/api': '' // rewrite path
        }
      }
    }
    // proxy: 'http://localhost:4000' // 配置跨域处理,只有一个代理
  },
  configureWebpack: {
    // 不显示文件过大优化建议
    performance: {
      hints: false
    },
    resolve: {
      alias: {
        '@': resolve(''),
        'components': resolve('components'),
        'widgets': resolve('widgets'),
        'vue$': process.env.NODE_ENV === 'production' ? 'vue' : 'vue/dist/vue.esm.js'
      }
    }
  }
}
